package com.star.common.orm.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 基础实体
 *
 * @author zhouhengzhe
 */
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@Data
public abstract class BasePO implements Serializable {

    public static final String ID = "id";
    public static final String CREATE_TIME = "create_time";
    public static final String UPDATE_TIME = "update_time";
    public static final String DEL_FLAG = "del_flag";
    private static final long serialVersionUID = 8243162602142898786L;

    @TableId(value = ID, type = IdType.AUTO)
    @ApiModelProperty("主键ID")
    private Long id;

    @TableField(value = CREATE_TIME, fill = FieldFill.INSERT)
    @ApiModelProperty("创建时间")
    private LocalDateTime createTime;

    @TableField(value = UPDATE_TIME, fill = FieldFill.INSERT_UPDATE)
    @ApiModelProperty("更新时间")
    private LocalDateTime updateTime;

    @TableLogic(value = "0", delval = "1")
    @TableField(value = DEL_FLAG, fill = FieldFill.INSERT)
    @ApiModelProperty("逻辑删除,1为逻辑删除")
    private Boolean delFlag;
}